package org.jash.shop2202.entity

import androidx.databinding.BaseObservable
import androidx.databinding.Bindable
import org.jash.shop2202.BR
import org.jash.shop2202.shop.CategoryFragment
import org.jash.shop2202.utils.bus
private var categoryId = 0
data class Category(
    val category_icon: String,
    val category_name: String,
    val `data`: List<Category>,
    val id: Int,
    val parent_id: Int
):BaseObservable() {

    fun showSubcategory() {
        categoryId = id
        notifyPropertyChanged(BR.selected)
        bus.postValue("展示子分类" to data)
    }
    fun showProduct() {
        bus.postValue("展示商品" to id)
    }
    @get:Bindable
    val selected:Boolean
        get() = categoryId == id
}